package com.zlh;

import java.util.List;

/**
 * @package com.zlh
 * @company: dacheng
 * @author: zlh
 * @createDate: 2021/4/27
 */
public class Person {
    private String name;
    private int age;
    private List<Person> childs;

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public List<Person> getChilds() {
        return childs;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setChilds(List<Person> childs) {
        this.childs = childs;
    }

    @Override
    public String toString() {
        int size = 0;
        if (this.childs != null){
            size = this.childs.size();
        }
        return "名字："+this.name+
                " 年龄："+this.age+
                " 共有"+size+"个孩子";
    }
}
